# -*- coding: utf-8 -*-
import xml.dom.minidom as dom

from renyare.log import logger

from renyare.xml import nsp as ren_nsp, ns_uri

# Create root document node
#_impl = dom.getDOMImplementation()
#_xml = _impl.createDocument(ns_uri, nsp+'page', None)

import lxml.etree as et

class RenyareWSGI(object):
	log = logger()

	def __init__(self, **kwargs):
		self.xml = _xml
		self.xml_root = self.xml.documentElement

	def __call__(self, environ, start_response, exc_info=None):
		self.environ = environ
		self.start_response = start_response
		for i in self.call():
			yield i

class RenyareMiddleware(RenyareWSGI):
	def __init__(self, app, *args, **kwargs):
		self.app = app
		RenyareWSGI.__init__(self, *args, **kwargs)

class RenyareApplication(RenyareWSGI):
	pass
